<?php

require_once "Common/values.php";
if ($_POST[operator]=='')
{

    $_POST[operator]='%';
}
if ($_POST[date]=='')
{

    $_POST[date]=$date;
}
if ($_POST[lognumber]=='')
{

    $_POST[lognumber]='%';
}
echo '<center><h1>Event Log</h1>';
echo '<form method="Post" Action=index.php?p=events>';
echo '<p>Operator : <select name="operator"><option>'.$_POST[operator].'</option><option> </option>';
genOperator();
echo '</select>';
echo 'Date : <input type="text" name="date" size="6" value="'.$_POST[date].'" /> ';
echo 'Log Number  : <input type="text" name="lognumber" size="6" value="'.$_POST[lognumber].'" /> ';
echo ' <input type="submit" value="Filter" name="Filter" /></form>';
echo '<p><table><tr><td>Log Number</td><td>Date</td><td>Time</td><td>Operator</td><td>Description</td><td>Time Spent</td></tr>';
$result = mysql_query("SELECT * FROM tblEvents WHERE Operator LIKE '$_POST[operator]' AND Date LIKE '$_POST[date]' AND LogNumber LIKE '$_POST[lognumber]' ORDER BY `key` ");

while($row = mysql_fetch_array($result))
{
echo '<tr><td>'.$row['LogNumber'].'</td><td>'.$row['Date'].'</td><td>'.$row['Time'].'</td><td>'.$row['Operator'].'</td><td>'.nl2br($row['description']).'</td><td>'.$row['TimeS'].'</tr>';


$total=$row[TimeS]+$total;

}
echo'</table>';
echo '<b>Total Time : </b>'.$total.' Mins';
?>
